package controller;

import android.app.Activity;
import android.content.Intent;
import android.fourrows.R;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class QuitGame extends Activity implements OnClickListener {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.save_game);

		Button save = (Button) findViewById(R.id.save_game_button);
		Button quit = (Button) findViewById(R.id.quit_right_away);
		Button cont = (Button) findViewById(R.id.continue_game);
		save.setOnClickListener(this);
		quit.setOnClickListener(this);
		cont.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Intent in = new Intent();
		switch (v.getId()) {

		case R.id.save_game_button:
			setResult(1, in);
			in.putExtra("fileName", "__saved_game__");
			break;
		case R.id.quit_right_away:
			Log.i("QuitGame", "quit_right_away_requested");
			setResult(2, in);
			break;
		case R.id.continue_game:
			Log.i("QuitGame", "Continue game requested");
			setResult(3, in);
			break;
		default:
			break;
		}
		finish();
	}
}
